# -*- coding:utf-8 -*-

from django.contrib import admin
from django.utils.html import format_html

from apitest.models import Apitest, Apistep, Apis, ApisSuite, ApitestSuite
from product.models import Product


# Register your models here.


class ApistepAdmin(admin.TabularInline):
    list_display = ['apiname', 'apiurl', 'apiparamvalue', 'apimethod', 'apiresult', 'apistatus', 'create_time', 'id',
                    'apitest']
    model = Apistep
    extra = 1


class ApitestAdmin(admin.ModelAdmin):
    list_display = ['apitestname', 'apitester', 'apitestresult', 'create_time', 'id']
    inlines = [ApistepAdmin]


class ApitestSuiteAdmin(admin.TabularInline):
    list_display = ['apitest_caseName', 'apitest_tester', 'create_time', 'update_time', 'id', 'product']
    inlines = [ApitestAdmin]


class ApisAdmin(admin.TabularInline):
    list_display = ['id', 'apiname', 'apiurl', 'apiparamvalue', 'apimethod', 'apiresult', 'apistatus', 'create_time',
                    'product']
    model = ApisSuite
    extra = 1


class ApisSuiteAdmin(admin.TabularInline):
    list_display = ['case_name', 'tester', 'create_time', 'update_time', 'id', 'product']
    inlines = [ApisAdmin]


admin.site.register(Apitest, ApitestAdmin)
admin.site.register(ApitestSuite)
admin.site.register(Apis)
admin.site.register(ApisSuite)

admin.site.site_title = 'Autotestplat'
admin.site.site_header = 'Autotestplat'
